package org.bean.spiral.processor;


import org.bean.spiral.annotations.Root;


public class AnnotationProcessor implements Processor {

  @SuppressWarnings("unchecked")
  public <E, T> E process(T element) {

    E newClass = null;
    Root root = element.getClass().getAnnotation(Root.class);
    Class<E> requiredClass = (Class<E>) root.rootClass();
    try {
      newClass = requiredClass.newInstance();
    } catch (InstantiationException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    }
    System.out.println(requiredClass);
    return newClass;
  }

}
